package homework;

public class test3 {
    public static void main(String[] args) {
        pd(1,100);
    }

    public static void pd(int start, int end) {
        int count = 0;
        for (int i = start; i <= end; i++) {
            if (sushu(i)) {
                System.out.print(i + " ");
                count++;
                if (count % 5 == 0) {
                    System.out.println();
                }
            }
        }
        System.out.println("\n共有"+count+"个素数");
    }

    public static boolean sushu(int number) {
        if (number <= 1) {
            return false;
        }
        for (int i = 2; i <= Math.sqrt(number); i++) {
            if (number % i == 0) {
                return false;
            }
        }
        return true;
    }
}
